//
// Rule.cs
//
// Copyright (C) 2008 Lukas Lipka <lukaslipka@gmail.com>
//

using System;
using System.Collections.Generic;

namespace Dashboard.Engine {

	public delegate IEnumerable<Match> QueryRule (ClueMessage message);

	public class Rule {

		private string relationship;
		private QueryRule query_rule;

		public Rule (string relationship, QueryRule query_rule)
		{
			this.relationship = relationship;
			this.query_rule = query_rule;
		}

		public IEnumerable<Match> Query (ClueMessage message)
		{
			if (query_rule == null)
				return null;

			return query_rule (message);
		}

		public string Relationship {
			get { return relationship; }
		}
	}
}
